//
//  QDAboutActorTableViewCell.swift
//  QDMetroClient
//
//  Created by YueWen on 2019/2/28.
//  Copyright © 2019 YueWen. All rights reserved.
//

import UIKit

/// 关于界面右侧可响应的cell
final class QDAboutActorTableViewCell: NWTableViewCell {

    /// 标签名称
    let titleLabel = UILabel()
    /// 响应的按钮
    let actionButton = UIButton()
    /// 点击响应
    var actionHandler: (()->())?
    
    override func buildView() {
        super.buildView()
        
        titleLabel.text = "官方客服电话"
        titleLabel.font = Font.regular.font(size: 16)
        titleLabel.textColor = QDColors.black
        
        actionButton.adjustsImageWhenHighlighted = false
        actionButton.setTitle("0532-55770000", for: .normal)
        actionButton.setTitleColor(QDColors.theme, for: .normal)
        actionButton.titleLabel?.font = Font.regular.font(size: 16)
        
        bottomLineView.backgroundColor = #colorLiteral(red: 0.9294117647, green: 0.9411764706, blue: 0.9333333333, alpha: 1)
        bottomLineInset.left = 20
        bottomLineInset.right = 20
        bottomLineHeight = 0.5
        
        contentView.addSubview(titleLabel)
        contentView.addSubview(actionButton)
        
        titleLabel.snp.makeConstraints { (make) in
            make.centerY.equalToSuperview()
            make.height.equalTo(22)
            make.left.equalToSuperview().offset(20)
        }
        
        actionButton.snp.makeConstraints { (make) in
            make.right.equalToSuperview().inset(20)
            make.height.equalTo(22)
            make.centerY.equalTo(titleLabel)
        }
        
        actionButton.addTarget(self, action: #selector(actionButtonDidTap), for: .touchUpInside)
    }
    
    
    @objc func actionButtonDidTap(){
        actionHandler?()
    }
}
